package com.ysqcould.allocation.service.impl;


import com.ysqcould.allocation.domain.IntegralAccount;
import com.ysqcould.allocation.domain.vo.IntegralVo;
import com.ysqcould.allocation.mapper.IntegralAccountMapper;
import com.ysqcould.allocation.service.IIntegralAccountService;
import com.ysqcould.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;
import java.util.stream.Collectors;

/**
 * 积分记录--积分账号Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-06-30
 */
@Service
public class IntegralAccountServiceImpl implements IIntegralAccountService
{
    @Autowired
    private IntegralAccountMapper integralAccountMapper;

    /**
     * 查询积分记录--积分账号
     * 
     * @param id 积分记录--积分账号主键
     * @return 积分记录--积分账号
     */
    @Override
    public IntegralAccount selectIntegralAccountById(Long id)
    {
        return integralAccountMapper.selectIntegralAccountById(id);
    }

    /**
     * 查询积分记录--积分账号列表
     *
     * @param integralAccount 积分记录--积分账号
     * @return 积分记录--积分账号
     */
    @Override
    public List<IntegralVo> selectIntegralAccountList(IntegralAccount integralAccount)
    {
        List<IntegralVo> integralVos = integralAccountMapper.selectIntegralAccountList(integralAccount);
        return integralVos;
    }

    /**
     * 新增积分记录--积分账号
     * 
     * @param integralAccount 积分记录--积分账号
     * @return 结果
     */
    @Override
    public int insertIntegralAccount(IntegralAccount integralAccount)
    {
        integralAccount.setCreateTime(DateUtils.getNowDate());
        return integralAccountMapper.insertIntegralAccount(integralAccount);
    }

    /**
     * 修改积分记录--积分账号
     * 
     * @param integralAccount 积分记录--积分账号
     * @return 结果
     */
    @Override
    public int updateIntegralAccount(IntegralAccount integralAccount)
    {
        integralAccount.setUpdateTime(DateUtils.getNowDate());
        return integralAccountMapper.updateIntegralAccount(integralAccount);
    }

    /**
     * 批量删除积分记录--积分账号
     * 
     * @param ids 需要删除的积分记录--积分账号主键
     * @return 结果
     */
    @Override
    public int deleteIntegralAccountByIds(Long[] ids)
    {
        return integralAccountMapper.deleteIntegralAccountByIds(ids);
    }

    /**
     * 删除积分记录--积分账号信息
     * 
     * @param id 积分记录--积分账号主键
     * @return 结果
     */
    @Override
    public int deleteIntegralAccountById(Long id)
    {
        return integralAccountMapper.deleteIntegralAccountById(id);
    }
}
